@extends('admin/layout')
@section('title','广告列表')
@section('content')
<!-- Content Header (Page header) -->
<section class="content-header">
    <h1>
        广告管理
        @if(session('error'))
            <div class="alert alert-danger">
                <li>{{ session('error') }}</li>
            </div>
        @endif
        @if(session('success'))
            <div class="alert alert-danger">
                <li>{{ session('success') }}</li>
            </div>
        @endif
        <small>广告列表</small>
    </h1>
    <ol class="breadcrumb">
        <li><a href="{{asset('admin/index')}}"><i class="fa fa-th"></i> 管理首页</a></li>
        <li><i class="fa fa-users"></i> 广告管理</li>
        <li class="active">广告列表</li>
    </ol>
</section>
<section class="content">
    <div class="row">
        <div class="col-xs-12">
            <div class="box">
                <div class="box-header">
                    <form action="/admin/ad/create">
                        <button style="width: 150px;height: 50px;background:#3C8DBC;color:#fff;font-size: 26px;">添加广告</button>
                    </form>
                </div><!-- /.box-header -->
                <div class="box-body">
                    <table id="example2" class="table table-bordered table-hover">
                        <thead>
                        <tr>
                            <th>ID</th>
                            <th>广告名称</th>
                            <th>广告图片</th>
                            <th>链接地址(s)</th>
                            <th>广告类型</th>
                            <th>广告状态</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        @foreach($data as $ad)
                            <tr>
                                <td>{{$ad->car_id}}</td>
                                <td>{{$ad->name}}</td>
                                <td><img width="70px" height="70px" src="{{$ad-> ad_pic}}"></td>
                                <td>{{$ad->link}}</td>
                                <td>{{$ad->class}}</td>
                                <td>
                                    @if($ad->disabled == 1)
                                        启用
                                    @else
                                        禁用
                                    @endif
                                </td>
                                <td>
                                    <span style="display: block;width: 45px;height: 25px;background: greenyellow;line-height: 25px;"><a href="/admin/ad/{{$ad -> car_id}}/edit/">&nbsp;&nbsp;编辑</a></span>
                                    <form action="/admin/ad/{{$ad -> car_id}}" method="post">
                                        {{csrf_field()}}
                                        {{method_field('DELETE')}}
                                        <button style="background: plum;">删除</button>
                                    </form>
                                </td>
                            </tr>
                        @endforeach
                        </tbody>
                    </table>
                </div><!-- /.box-body -->
            </div><!-- /.box -->


        </div><!-- /.col -->
    </div><!-- /.row -->
</section><!-- /.content -->
</div><!-- /.cont
</section>
@stop